package com.example.tally.adapter;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

/**
 * @author:0.2℃
 * @date： 2021-07-13 17:44
 * @Description ：
 */

public class RecordPageAdapter extends FragmentPagerAdapter {
    List<Fragment> fragmentList;
    String[] titles = {"支出" , "收入"};
    public RecordPageAdapter(@NonNull FragmentManager fm , List<Fragment> fragmentList) {
        super(fm);
        this.fragmentList = fragmentList;
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
